#include "mxsetup.h"

/* the stack for system boot, after the first thread is runing by call `mx_thread_schedule` function
   in boot.c, this region will be a part of heap memory */
/* NOINIT make this area place in ZI (.bss), so that doesn't occupy flash space */
               AREA    STACK, NOINIT, READWRITE, ALIGN=3
               EXPORT  __stack_base
               SPACE   MXSETUP_BOOT_STACK_SIZE
__stack_base
               // here create a symbol `__stack_base` in this section (AREA)

; vector table region
               AREA    RESET, DATA, READONLY
               EXPORT __vectors
               EXPORT __vectors_end
               EXPORT __vectors_size
               IMPORT __start
               IMPORT vector_exception
               IMPORT vector_irq

__vectors      \
               ; Internal Interrupts
               DCD     __stack_base       ; __stack_base                        ; Top of Stack
               DCD     __start            ; __start                             ; Reset Handler
               DCD     vector_exception   ; NMI_Handler                         ; NMI Handler
               DCD     vector_exception   ; HardFault_Handler                   ; Hard Fault Handler
               DCD     vector_exception   ; MemManage_Handler                   ; MPU Fault Handler
               DCD     vector_exception   ; BusFault_Handler                    ; Bus Fault Handler
               DCD     vector_exception   ; UsageFault_Handler                  ; Usage Fault Handler
               DCD     vector_exception   ; 0                                   ; Reserved
               DCD     vector_exception   ; 0                                   ; Reserved
               DCD     vector_exception   ; 0                                   ; Reserved
               DCD     vector_exception   ; 0                                   ; Reserved
               DCD     vector_exception   ; SVC_Handler                         ; SVCall Handler
               DCD     vector_exception   ; DebugMon_Handler                    ; Debug Monitor Handler
               DCD     vector_exception   ; 0                                   ; Reserved
               DCD     vector_irq         ; PendSV_Handler                      ; PendSV Handler
               DCD     vector_irq         ; SysTick_Handler                     ; SysTick Handler
               ; External Interrupts
               DCD     vector_irq         ; WWDG_IRQHandler                     ; Window WatchDog
               DCD     vector_irq         ; PVD_IRQHandler                      ; PVD through EXTI Line detection
               DCD     vector_irq         ; TAMP_STAMP_IRQHandler               ; Tamper and TimeStamps through the EXTI line
               DCD     vector_irq         ; RTC_WKUP_IRQHandler                 ; RTC Wakeup through the EXTI line
               DCD     vector_irq         ; FLASH_IRQHandler                    ; FLASH
               DCD     vector_irq         ; RCC_IRQHandler                      ; RCC
               DCD     vector_irq         ; EXTI0_IRQHandler                    ; EXTI Line0
               DCD     vector_irq         ; EXTI1_IRQHandler                    ; EXTI Line1
               DCD     vector_irq         ; EXTI2_IRQHandler                    ; EXTI Line2
               DCD     vector_irq         ; EXTI3_IRQHandler                    ; EXTI Line3
               DCD     vector_irq         ; EXTI4_IRQHandler                    ; EXTI Line4
               DCD     vector_irq         ; DMA1_Stream0_IRQHandler             ; DMA1 Stream 0
               DCD     vector_irq         ; DMA1_Stream1_IRQHandler             ; DMA1 Stream 1
               DCD     vector_irq         ; DMA1_Stream2_IRQHandler             ; DMA1 Stream 2
               DCD     vector_irq         ; DMA1_Stream3_IRQHandler             ; DMA1 Stream 3
               DCD     vector_irq         ; DMA1_Stream4_IRQHandler             ; DMA1 Stream 4
               DCD     vector_irq         ; DMA1_Stream5_IRQHandler             ; DMA1 Stream 5
               DCD     vector_irq         ; DMA1_Stream6_IRQHandler             ; DMA1 Stream 6
               DCD     vector_irq         ; ADC_IRQHandler                      ; ADC1, ADC2 and ADC3s
               DCD     vector_irq         ; CAN1_TX_IRQHandler                  ; CAN1 TX
               DCD     vector_irq         ; CAN1_RX0_IRQHandler                 ; CAN1 RX0
               DCD     vector_irq         ; CAN1_RX1_IRQHandler                 ; CAN1 RX1
               DCD     vector_irq         ; CAN1_SCE_IRQHandler                 ; CAN1 SCE
               DCD     vector_irq         ; EXTI9_5_IRQHandler                  ; External Line[9:5]s
               DCD     vector_irq         ; TIM1_BRK_TIM9_IRQHandler            ; TIM1 Break and TIM9
               DCD     vector_irq         ; TIM1_UP_TIM10_IRQHandler            ; TIM1 Update and TIM10
               DCD     vector_irq         ; TIM1_TRG_COM_TIM11_IRQHandler       ; TIM1 Trigger and Commutation and TIM11
               DCD     vector_irq         ; TIM1_CC_IRQHandler                  ; TIM1 Capture Compare
               DCD     vector_irq         ; TIM2_IRQHandler                     ; TIM2
               DCD     vector_irq         ; TIM3_IRQHandler                     ; TIM3
               DCD     vector_irq         ; TIM4_IRQHandler                     ; TIM4
               DCD     vector_irq         ; I2C1_EV_IRQHandler                  ; I2C1 Event
               DCD     vector_irq         ; I2C1_ER_IRQHandler                  ; I2C1 Error
               DCD     vector_irq         ; I2C2_EV_IRQHandler                  ; I2C2 Event
               DCD     vector_irq         ; I2C2_ER_IRQHandler                  ; I2C2 Error
               DCD     vector_irq         ; SPI1_IRQHandler                     ; SPI1
               DCD     vector_irq         ; SPI2_IRQHandler                     ; SPI2
               DCD     vector_irq         ; USART1_IRQHandler                   ; USART1
               DCD     vector_irq         ; USART2_IRQHandler                   ; USART2
               DCD     vector_irq         ; USART3_IRQHandler                   ; USART3
               DCD     vector_irq         ; EXTI15_10_IRQHandler                ; External Line[15:10]s
               DCD     vector_irq         ; RTC_Alarm_IRQHandler                ; RTC Alarm (A and B) through EXTI Line
               DCD     vector_irq         ; OTG_FS_WKUP_IRQHandler              ; USB OTG FS Wakeup through EXTI line
               DCD     vector_irq         ; TIM8_BRK_TIM12_IRQHandler           ; TIM8 Break and TIM12
               DCD     vector_irq         ; TIM8_UP_TIM13_IRQHandler            ; TIM8 Update and TIM13
               DCD     vector_irq         ; TIM8_TRG_COM_TIM14_IRQHandler       ; TIM8 Trigger and Commutation and TIM14
               DCD     vector_irq         ; TIM8_CC_IRQHandler                  ; TIM8 Capture Compare
               DCD     vector_irq         ; DMA1_Stream7_IRQHandler             ; DMA1 Stream7
               DCD     vector_irq         ; FSMC_IRQHandler                     ; FSMC
               DCD     vector_irq         ; SDIO_IRQHandler                     ; SDIO
               DCD     vector_irq         ; TIM5_IRQHandler                     ; TIM5
               DCD     vector_irq         ; SPI3_IRQHandler                     ; SPI3
               DCD     vector_irq         ; UART4_IRQHandler                    ; UART4
               DCD     vector_irq         ; UART5_IRQHandler                    ; UART5
               DCD     vector_irq         ; TIM6_DAC_IRQHandler                 ; TIM6 and DAC1&2 underrun errors
               DCD     vector_irq         ; TIM7_IRQHandler                     ; TIM7
               DCD     vector_irq         ; DMA2_Stream0_IRQHandler             ; DMA2 Stream 0
               DCD     vector_irq         ; DMA2_Stream1_IRQHandler             ; DMA2 Stream 1
               DCD     vector_irq         ; DMA2_Stream2_IRQHandler             ; DMA2 Stream 2
               DCD     vector_irq         ; DMA2_Stream3_IRQHandler             ; DMA2 Stream 3
               DCD     vector_irq         ; DMA2_Stream4_IRQHandler             ; DMA2 Stream 4
               DCD     vector_irq         ; ETH_IRQHandler                      ; Ethernet
               DCD     vector_irq         ; ETH_WKUP_IRQHandler                 ; Ethernet Wakeup through EXTI line
               DCD     vector_irq         ; CAN2_TX_IRQHandler                  ; CAN2 TX
               DCD     vector_irq         ; CAN2_RX0_IRQHandler                 ; CAN2 RX0
               DCD     vector_irq         ; CAN2_RX1_IRQHandler                 ; CAN2 RX1
               DCD     vector_irq         ; CAN2_SCE_IRQHandler                 ; CAN2 SCE
               DCD     vector_irq         ; OTG_FS_IRQHandler                   ; USB OTG FS
               DCD     vector_irq         ; DMA2_Stream5_IRQHandler             ; DMA2 Stream 5
               DCD     vector_irq         ; DMA2_Stream6_IRQHandler             ; DMA2 Stream 6
               DCD     vector_irq         ; DMA2_Stream7_IRQHandler             ; DMA2 Stream 7
               DCD     vector_irq         ; USART6_IRQHandler                   ; USART6
               DCD     vector_irq         ; I2C3_EV_IRQHandler                  ; I2C3 event
               DCD     vector_irq         ; I2C3_ER_IRQHandler                  ; I2C3 error
               DCD     vector_irq         ; OTG_HS_EP1_OUT_IRQHandler           ; USB OTG HS End Point 1 Out
               DCD     vector_irq         ; OTG_HS_EP1_IN_IRQHandler            ; USB OTG HS End Point 1 In
               DCD     vector_irq         ; OTG_HS_WKUP_IRQHandler              ; USB OTG HS Wakeup through EXTI
               DCD     vector_irq         ; OTG_HS_IRQHandler                   ; USB OTG HS
               DCD     vector_irq         ; DCMI_IRQHandler                     ; DCMI
               DCD     vector_irq         ; CRYP_IRQHandler                     ; CRYP crypto
               DCD     vector_irq         ; HASH_RNG_IRQHandler                 ; Hash and Rng
               DCD     vector_irq         ; FPU_IRQHandler                      ; FPU
__vectors_end
__vectors_size EQU __vectors_end - __vectors

               END
